Skip to content

feat: Added part_size param to transfer manager for MultipartUploader.#3118

Open
yurguis wants to merge 4 commits into
aws:masterfrom
yurguis:feat-add-partsize-param-to-transfer-manager
Open

feat: Added part_size param to transfer manager for MultipartUploader.#3118
yurguis wants to merge 4 commits into
aws:masterfrom
yurguis:feat-add-partsize-param-to-transfer-manager

Conversation

@yurguis

@yurguis yurguis commented May 9, 2025

Copy link
Copy Markdown

Description of changes:
Adds a new parameter to transfer manager's options array (part_size) to allow to specify the part size for multipart uploads.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@yenfryherrerafeliz

Copy link
Copy Markdown
Contributor

Hi @yurguis, thanks for this contribution. Would you please be able to add a test case for this change?

Thanks!

@yurguis

yurguis commented May 22, 2025

Copy link
Copy Markdown
Author

Hi @yenfryherrerafeliz, just updated the PR with a test case for this change. Let me know if there is anything else needed.

Thanks!

Comment thread src/S3/Transfer.php
Comment on lines +122 to +124
$this->partSize = isset($options['part_size'])
? $options['part_size']
: MultipartUploader::PART_MIN_SIZE;

@stobrien89 stobrien89 Jun 23, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be some validation here against MultipartUploader::PART_MIN_SIZE and MultipartUploader::PART_MAX_SIZE. If it's less than the min size or greater than the max size, throw an InvalidArgumentException

Comment thread src/S3/Transfer.php

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

part_size is missing a docblock entry in the "The options array can contain the following key value pairs..." section

Comment thread tests/S3/TransferTest.php

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a couple more tests following the validation suggestions above

Comment thread tests/S3/TransferTest.php
$t->transfer();
rewind($res);
$output = stream_get_contents($res);
$this->assertStringNotContainsString("Transferring $filename -> s3://foo/bar/large.txt (UploadPart) : Part=3", $output);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test asserts only the absence of a Part=3 line. better to assert positively or via mock command capture (Middleware::tap())

@stobrien89

Copy link
Copy Markdown
Member

Hi @yurguis,

Sorry for the long delay- Just left a couple of comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants